package com.smart.seven.aop.advice.introductioninterceptor;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 测试类
 *
 * @author junrui.wang
 * @create 2018/6/14
 */
public class Test {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("classpath*:com/smart/seven/aop/advice/introductioninterceptor/beans.xml");
        ForumService forumService = (ForumService) ac.getBean("forumService");
        forumService.removeTopic(100);
        forumService.removeForum(100);

        //开启性能监视
        //可以强制性转为Monitorable，代码没有报错说明Spring返回的代理确实引入了Monitorable接口方法的实现
        Monitorable monitorable = (Monitorable) forumService;
        monitorable.setMonitorActive(true);

        forumService.removeTopic(100);
        forumService.removeForum(100);
    }
}
